<?php
class Arm_Form_Element_Cep extends Zend_Form_Element
{
  public function init(){
    parent::init();

    $this ->addValidator(new Zend_Validate_Regex('/^\d{5}-\d{3}$/'));
    $this ->setOptions(array(
      'size'        => 10,
      'maxlength'   => 9,
      'onkeyup'     => 'formCepMasc(this.id)',
      'onblur'      => 'validateCep(this.id)',
    ));

    $this->addErrorMessage('CEP no formato inválido! Utilize, por exemplo, 99999-999');
    $this ->addFilter('StripTags');
    $this ->addFilter('StringTrim');
    $this ->addFilter('StringToLower');
  }
}
